﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;
using System.Data.Objects;

namespace MShop.Core.DataAccess
{
    public interface ICommonDao<T>:ICommonDao
    {
        IQueryable<T> GetAll();

        IQueryable<T> Find(Expression<Func<T, bool>> expr);

        IQueryable<T> Page<Tkey>(int pageSize,int pageIndex, Sort sort,Expression<Func<T, bool>> expr, Expression<Func<T,Tkey>> keySelector, out int totalItemCount);

        void Save(T entity);

        void Delete(T entity);

        void Update(T entity);

        T FirstOrDefault();

        T FirstOrDefault(Expression<Func<T, bool>> expr);

        T GetById(object oid);

        T Get(Expression<Func<T, bool>> expr);

        IQueryable<T> Find(string query, params ObjectParameter[] parameter);


        string PrimaryKey { get; set; }
       
    }

    public interface ICommonDao
    {
         
        void Save(object entity);

        void Delete(object entity);

        void Update(object entity);

        int SaveChanges();  

        ObjectContext ObjectContext { get; }

    }






}
